package gff.bsn;


import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;

import org.apache.log4j.Logger;



public class ListenerSessionAndCtx implements javax.servlet.http.HttpSessionListener, 
javax.servlet.ServletContextListener,
javax.servlet.http.HttpSessionAttributeListener{

	private static final Logger log = Logger.getLogger(ListenerSessionAndCtx.class);

	@Override
	public void attributeAdded(HttpSessionBindingEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void attributeRemoved(HttpSessionBindingEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void attributeReplaced(HttpSessionBindingEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void contextInitialized(ServletContextEvent ctxEvent) {
		log.info("\n\n  *****************");
		log.info("Iniciando Contexto");
		log.info("4.1*****************\n");
		log.info("Servlets: " + Integer.toString(ctxEvent.getServletContext().getMajorVersion()) + "." +		
				Integer.toString(ctxEvent.getServletContext().getMinorVersion()));
				//ServletContext sCtx = ctxEvent.getServletContext();	
		
			try {
			
				
				
			} catch (Exception e) {
				log.info("Error al obtener el catalogo de precios de los medicamentos " +  e.getMessage());
			}
		
		
		
		
	}

	@Override
	public void sessionCreated(HttpSessionEvent arg0) {
		HttpSession session=arg0.getSession();
		log.info("------> Session Iniciada: " + session.getId());	
		
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}
